using System.Collections;

namespace OpenXmlWriter.Packaging
{
  public class RelationshipCollection : CollectionBase
  {
    public int Add(Relationship relationship)
    {
      return List.Add(relationship);
    }

    public Relationship this[int index]
    {
      get
      {
        return (Relationship) List[index];
      }
      set
      {
        List[index] = value;
      }
    }

    public Relationship GetByTarget(string target)
    {
      foreach (Relationship relationship in List)
      {
        if (relationship.TargetPath == target)
        {
          return relationship;
        }
      }
      return null;
    }
  }
}